package controllers;

import java.io.IOException;

import ccrm.BoundryControl;
import ccrm.ClientMain;
import entitys.Product;
import entitys.Request;
import entitys.Session;
import enums.Command;
import enums.Result;

public class DeleteProductController {
	
	/**
	 * Send request to server to get all the Products.
	 */
	public static void getProducts()
	{
		Request r =new Request(Command.GET_PRODUCTS,Session.getEmployee().getUserId());
		
		try {
			ClientMain.client.sendToServer(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	/**
	 * Send request to server to delete a Product.
	 */
	public static void deleteProduct(String p)
	{
		Request r =new Request(Command.DELETE_PRODUCT,Session.getEmployee().getUserId(),p.substring(1, p.indexOf(' ')));

		try {
			ClientMain.client.sendToServer(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	
	}
}
